/**
 * 
 */
package ru.olympus.antonyhands.ao.server.item.util;

import com.google.common.base.Function;

import ru.olympus.antonyhands.ao.server.db.AOData;
import ru.olympus.antonyhands.ao.server.item.ItemQuantityPair;
import ru.olympus.antonyhands.ao.shared.util.StringPair;
import ru.olympus.antonyhands.ao.shared.util.StringUtilities;

/**
 * @author AntonyHands
 * @since 28.02.2012
 */
public class StringPairToItemQuantityPairTransformer implements Function<StringPair, ItemQuantityPair>
{

    @Override
    public ItemQuantityPair apply(StringPair sp)
    {
        return new ItemQuantityPair(AOData.getInstance().getItemByCode(sp.getKey()),
        		StringUtilities.stringToLong(sp.getValue()));
    }

}
